﻿<%@ Page Language="C#" MasterPageFile="~/LTR/MlyLtrMaster.Master" AutoEventWireup="true"
    CodeBehind="WoDownload.aspx.cs" Inherits="MLY.LTR.WoDownload" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="title" ContentPlaceHolderID="titleHolder" runat="server">

    <script type="text/javascript">
        function textChange() {
            $get("HiddenField1").value = $get("fromDateBox").value;
        }
        window.onload = function() {
            $("#data_transfermenuitem").addClass('active');
        }
    </script>

    <title>
        <asp:Literal ID="Literal21" Text='<%$Dict:Titles.WoDownload%>' runat="server"></asp:Literal>
    </title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:Label ForeColor="Red" ID="errBox" Visible="false" Font-Bold="true" runat="server"></asp:Label>
    <asp:HiddenField ID="HiddenField1" runat="server" />
      <asp:HiddenField ID="isClientHidden" runat="server" />
    <table class="blueTxtBox addWoFrmCls" border="0" cellpadding="3" id="win-xp">
        <tr>
            <td colspan="1">
                <% if (Request.QueryString["isclient"] != null)
                   { %>
                <asp:Literal runat="server" ID="Literal1" Text='<%$Dict:woDownload.ChooseClient%>'></asp:Literal>
                <%}
                   else
                   {%>
                <asp:Literal runat="server" ID="myLit" Text='<%$Dict:woDownload.ChooseContractor%>'></asp:Literal>
                <% } %>
            </td>
            <td>
                <asp:DropDownList ID="ContractorIdDdl" runat="server" AutoPostBack="true" CssClass="filterDdl"
                    DataTextField="OrganizationName" DataValueField="OrganizationId" OnDataBound="ContractorIdDdl_DataBound">
                </asp:DropDownList>
            </td>
            <td colspan="2">
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <uc:StyledCheckBox ID="RadioButton1" runat="server" Text='<%$Dict:woDownload.selectSingleDate%>'
                    AutoPostBack="true" />
            </td>
            <td colspan="2" rowspan="3">
                <table border="0" cellpadding="3" cellspacing="0">
                    <tr>
                        <td>
                            <asp:Literal runat="server" ID="Literal4" Text='<%$Dict:woDownload.FromDate%>' />
                        </td>
                        <td>
                            <asp:Panel ID="fromPanel" runat="server">
                                <asp:TextBox ID="fromDateBox" runat="server" Width="210" Text='<%# Bind("myDate") %>'></asp:TextBox>
                                <KBMControls:KbmCalendar TargetControlID="fromDateBox" ID="CalendarExtender1" runat="server">
                                </KBMControls:KbmCalendar>
                            </asp:Panel>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Literal runat="server" ID="Literal5" Text='<%$Dict:woDownload.FromDate%>' />
                        </td>
                        <td rowspan="2">
                            <asp:Panel runat="server" ID="fromToPanel">
                                <asp:TextBox ID="FromDateBoxes" runat="server" Width="210"></asp:TextBox>
                                <KBMControls:KbmCalendar TargetControlID="FromDateBoxes" ID="CalendarExtender2" runat="server">
                                </KBMControls:KbmCalendar>
                                <br clear="all" />
                                <asp:TextBox ID="ToDateBoxes" runat="server" Width="210"></asp:TextBox>
                                <KBMControls:KbmCalendar TargetControlID="ToDateBoxes" ID="CalendarExtender3" runat="server">
                                </KBMControls:KbmCalendar>
                            </asp:Panel>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Literal runat="server" ID="Literal6" Text='<%$Dict:woDownload.ToDate%>' />
                        </td>
                        <td>
                        </td>
                    </tr>
                </table>
        </tr>
        <tr>
            <td colspan="2">
                <uc:StyledCheckBox ID="RadioButton2" Text='<%$Dict:woDownload.selectTwoDate%>' runat="server"
                    AutoPostBack="true" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:Literal runat="server" ID="Literal7" Text='<%$Dict:woDownload.chooseFormat%>' />
            </td>
            <td>
                <asp:DropDownList ID="formatDdl" AutoPostBack="true" runat="server" CssClass="filterDdl">
                    <asp:ListItem Selected="True" Value="xml">Xml</asp:ListItem>
                    <asp:ListItem Value="Csv">Csv</asp:ListItem>
                </asp:DropDownList>
            </td>
            <td colspan="2">
            </td>
        </tr>
        <tr>
            <td colspan="4">
                <table style="text-align: center; font-size: 12px; float: right;" border="0" cellspacing="0"
                    cellpadding="0">
                    <tr>
                        <td style="width: 67px; text-align: left;">
                            <asp:Button CssClass="smallBtn Btn" Text='<%$ Dict:General.Submit %>' runat="server"
                                OnClick="btnOk_Click1" />
                        </td>
                        <td style="width: 26px; text-align: center;">
                            <img src="/Images/contact_person/division_between_icon.jpg" />
                        </td>
                        <td>
                            <asp:Button ID="Button1" CssClass="smallBtn Btn" Text='<%$ Dict:General.Close %>'
                                runat="server" OnClick="btnCancel_Click" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>

    <script type="text/javascript">
        function doSubmit() {
            var SelectedFormat = $('#<%= formatDdl.ClientID %>').val();
            var SelectedVal = $('#<%= ContractorIdDdl.ClientID %>').val();
            var radio = $("#<%= RadioButton1.ClientID %>");
            var domRadio = radio[0];
            var isChecked = domRadio.checked;
            var queryString = "format=" + SelectedFormat + "&submit=true&orgId=" + SelectedVal;
            if (isChecked == true) {
                var fromDate = $("#<%= fromDateBox.ClientID %>").val();
                if (fromDate != "")
                    queryString += "&fromDate=" + fromDate;
            }
            else {
                var fromDate = $("#<%= FromDateBoxes.ClientID %>").val();
                if (fromDate != "")
                    queryString += "&fromDate=" + fromDate;
                var toDate = $("#<%= ToDateBoxes.ClientID %>").val();
                if (toDate != "")
                    queryString += "&toDate=" + toDate;

            }
            window.open("WoDownload.aspx?" + queryString);
            window.location = ("WoDownload.aspx?goback=true");
        }
    </script>

</asp:Content>
